//
//  main.m
//  day1-Demo2类的定义
//
//  Created by Maggie on 15/8/1.
//  Copyright (c) 2015年 fmning. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Person.h"

int main(int argc, const char * argv[]) {
    //实例化Person对象
//    Person *p = [[Person alloc]init];
    Person *p = [[Person alloc] initWithAge:12 andName:@"tom"];
    p.age = 23;//使用.操作符对_age赋值
//    [p setAge:23];//调用_age的Setter赋值
    int age = p.age;//使用.操作符访问_age
//    age = [p age];//使用_age的Getter方法访问_age
    
//    p = [p init];
    
    //给对象的属性赋值
//    p.age = 12;
//    p.name = @"tom";
    
    //打印P的个人资料
    [p print];
    
    //
    Person *anotherP = [[Person alloc]initWithAge:21 andName:@"maggie"];
//    anotherP.age = 21;
//    anotherP.name = @"maggie";
    
    [p eatWith:anotherP];
    [p eatWith:anotherP andWhere:@"朱红星" andWhat:@"拉面"];
    
    
    return 0;
}



